# In[1]

# 项目地址
# https://easytrader.readthedocs.io/zh/master/usage/
# 文档
# https://easytrader.readthedocs.io/zh/master/usage/#3


import jqktrader
from jqktrader.log import logger

user = jqktrader.use()

user.connect(
  exe_path=r'C:\同花顺软件\同花顺\xiadan.exe',
  tesseract_cmd=r'C:\Program Files\Tesseract-OCR\tesseract.exe'
)


# In[2]

# 7-29日待测试
# 获取资金状况
user.balance
# 获取持仓
user.position

# In[3]

# 7-29日待测试
user.buy('601238', price=7.82, amount=100)

# In[4]

user.cancel_entrust('0262839113')

# In[5]
# 7-29日待测试
# 获取持仓
user.position

# In[6]
# 获取资金状况
user.balance
# 获取持仓
user.position
# 查询委托
user.today_entrusts

# In[7]
# 买入
user.buy('162411', price=0.55, amount=100)
# 卖出
user.sell('162411', price=0.55, amount=100)
# 撤单
user.cancel_entrust('buy/sell 获取的 entrust_no')

# In[8]